package com.htandroid.htandroid.webservice;

import com.htandroid.htandroid.entity.RdrecordsAppList_detail;
import com.htandroid.htandroid.entity.UffjqgdList_detail;
import com.htandroid.htandroid.sys.Basenvo;

import java.util.ArrayList;

//生成xml的文本信息
public class BuildKcappdetailXMLService {

    public String buildXML(ArrayList<RdrecordsAppList_detail> rdslist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (rdslist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < rdslist.size(); i++) {
                RdrecordsAppList_detail rds = rdslist.get(i);
                xmlstring = xmlstring + "<RdrecordsAppList_detail xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<ID>" + Basenvo.AdjDigest(rds.getID()) + "</ID>\r\n";
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(rds.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cwhcode>" + Basenvo.AdjDigest(rds.getCwhcode()) + "</cwhcode>\r\n";
                xmlstring = xmlstring + "<cwhname>" + Basenvo.AdjDigest(rds.getCwhname()) + "</cwhname>\r\n";
                xmlstring = xmlstring + "<cdepcode>" + Basenvo.AdjDigest(rds.getCdepcode()) + "</cdepcode>\r\n";
                xmlstring = xmlstring + "<cdepname>" + Basenvo.AdjDigest(rds.getCdepname()) + "</cdepname>\r\n";
                xmlstring = xmlstring + "<cinvcode>" + Basenvo.AdjDigest(rds.getCinvcode()) + "</cinvcode>\r\n";
                xmlstring = xmlstring + "<inum>" + Basenvo.AdjDigest(rds.getInum()) + "</inum>\r\n";
                xmlstring = xmlstring + "<isnum>" + Basenvo.AdjDigest(rds.getIsnum()) + "</isnum>\r\n";
                xmlstring = xmlstring + "<isquantity>" + Basenvo.AdjDigest(rds.getIsquantity()) + "</isquantity>\r\n";
                xmlstring = xmlstring + "<cdefine22>" + Basenvo.AdjDigest(rds.getCdefine22()) + "</cdefine22>\r\n";
                xmlstring = xmlstring + "<cdefine23>" + Basenvo.AdjDigest(rds.getCdefine23()) + "</cdefine23>\r\n";
                xmlstring = xmlstring + "<cdefine24>" + Basenvo.AdjDigest(rds.getCdefine24()) + "</cdefine24>\r\n";
                xmlstring = xmlstring + "<cdefine25>" + Basenvo.AdjDigest(rds.getCdefine25()) + "</cdefine25>\r\n";
                xmlstring = xmlstring + "<cinvname>" + Basenvo.AdjDigest(rds.getCinvname()) + "</cinvname>\r\n";
                xmlstring = xmlstring + "<cinvstd>" + Basenvo.AdjDigest(rds.getCinvstd()) + "</cinvstd>\r\n";
                xmlstring = xmlstring + "<cinvm_unit>" + Basenvo.AdjDigest(rds.getCinvm_unit()) + "</cinvm_unit>\r\n";
                xmlstring = xmlstring + "<cinva_unit>" + Basenvo.AdjDigest(rds.getCinva_unit()) + "</cinva_unit>\r\n";
                xmlstring = xmlstring + "<iinvexchrate>" + Basenvo.AdjDigest(rds.getIinvexchrate()) + "</iinvexchrate>\r\n";
                xmlstring = xmlstring + "<binvquality>" + Basenvo.AdjDigest(rds.getBinvquality()) + "</binvquality>\r\n";
                xmlstring = xmlstring + "<cdisapprovereason>" + Basenvo.AdjDigest(rds.getCdisapprovereason()) + "</cdisapprovereason>\r\n";
                xmlstring = xmlstring + "<bapprove>" + Basenvo.AdjDigest(rds.getBapprove()) + "</bapprove>\r\n";
                xmlstring = xmlstring + "<rds_appid>" + Basenvo.AdjDigest(rds.getRds_appid()) + "</rds_appid>\r\n";
                xmlstring = xmlstring + "<inorder>" + Basenvo.AdjDigest(rds.getInorder()) + "</inorder>\r\n";
                xmlstring = xmlstring + "<ctype>" + Basenvo.AdjDigest(rds.getCtype()) + "</ctype>\r\n";
                xmlstring = xmlstring + "<iquantity>" + Basenvo.AdjDigest(rds.getIquantity()) + "</iquantity>\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(rds.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(rds.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<cdefine26>" + Basenvo.AdjDigest(rds.getCdefine26()) + "</cdefine26>\r\n";
                xmlstring = xmlstring + "<cdefine27>" + Basenvo.AdjDigest(rds.getCdefine27()) + "</cdefine27>\r\n";
                xmlstring = xmlstring + "<notaxprice>" + Basenvo.AdjDigest(rds.getNotaxprice()) + "</notaxprice>\r\n";
                xmlstring = xmlstring + "<taxrate>" + Basenvo.AdjDigest(rds.getTaxrate()) + "</taxrate>\r\n";
                xmlstring = xmlstring + "<tax>" + Basenvo.AdjDigest(rds.getTax()) + "</tax>\r\n";
                xmlstring = xmlstring + "<notaxamount>" + Basenvo.AdjDigest(rds.getNotaxamount()) + "</notaxamount>\r\n";
                xmlstring = xmlstring + "<cchecker>" + Basenvo.AdjDigest(rds.getCchecker()) + "</cchecker>\r\n";
                xmlstring = xmlstring + "<ccheckdate>" + Basenvo.AdjDigest(rds.getCcheckdate()) + "</ccheckdate>\r\n";
                xmlstring = xmlstring + "<cdefine4>" + Basenvo.AdjDigest(rds.getCdefine4()) + "</cdefine4>\r\n";
                xmlstring = xmlstring + "<succount>" + Basenvo.AdjDigest(rds.getSuccount()) + "</succount>\r\n";
                xmlstring = xmlstring + "<bclose>" + Basenvo.AdjDigest(rds.getBclose()) + "</bclose>\r\n";
                xmlstring = xmlstring + "<dclose_date>" + Basenvo.AdjDigest(rds.getDclose_date()) + "</dclose_date>\r\n";
                xmlstring = xmlstring + "</RdrecordsAppList_detail>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
